package com.atguigu.day03;

import java.util.concurrent.atomic.AtomicInteger;

//CAS
public class CASDemo0 {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(6);//初始值为6
        System.out.println(atomicInteger.compareAndSet(6, 555)+"\t"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(6, 666)+"\t"+atomicInteger.get());

    }
}
